<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>编辑菜单信息</title>
<load href="__PUBLIC__/css/bootstrap.min.css" />
<import type='css' file="css.main" />
<load href="__PUBLIC__/js/jquery-1.9.1.min.js" />
<import type='js' file="js.main" />
<style>
.getcxaddres{margin-left: 10px; padding: 6px 12px; cursor: pointer; padding-top: 5px; border: solid 1px #cccccc; background-color: #e7e7e7; color: #000000; border-radius: 2px; overflow: hidden;}
.getcxaddres1{margin-left: 10px; padding: 6px 12px; cursor: pointer; padding-top: 5px; border: solid 1px #cccccc; background-color: #e7e7e7; color: #000000; border-radius: 2px; overflow: hidden;}
.jiuma .jiumalist li h4{margin-top:8px;}
</style>
<script type="text/javascript">
$(function(){
	var mparent = "{$result.mparent}";
	$("select[name='mparent'] option").each(function(index, element) {
        if($(this).val()==mparent){
			$(this).attr("selected","selected");	
		}
    });
	var mtype = "{$result.mtype}";
	$("select[name='mtype'] option").each(function(index, element) {
        if($(this).val()==mtype){
			$(this).attr("selected","selected");	
		}
    });
	var classtype = "{$result.classtype}";
	$("select[name='classtype'] option").each(function(index, element) {
        if($(this).val()==classtype){
			$(this).attr("selected","selected");	
		}
    });
	
	var extstr = "{$result.position}";
	var arr = extstr.split(",");
	for(var i in arr){
		set_flag_v(arr[i]);
	}
	function set_flag_v(v){
		$("input.extendedattr").each(function(index, element) {
			var t = $(this);
			if(t.val()==v){
				t.attr("checked","checked");	
			}
		});
	}
	
	var template = "{$result.classtype}";
	$("select[name='classtype'] option").each(function(index, element) {
        if($(this).val()==template){
			$(this).attr("selected","selected");
			$(".thumbpreview:eq("+(index)+")").show().siblings().hide();	
		}
    });
	
	var positionid = "{$Think.get.id}";
	$("select[name='mparent'] option").each(function(index, element) {
        if($(this).val()==positionid){
			$(this).remove();
		}
    });
})
</script>
</head>

<body>
<div class="jiumabg">
	<div class="jiuma" style="width:500px;">
    	<div class="jiumaclose">X</div>
		<div class="jiuma_from"><input type="hidden" name="ycid" /><input name='searkey' type="text" placeholder="输入诚信节目人名称" /><a id="searchsubmit">搜索</a></div>
		<div class="jiumalist" style="height:310px;">正在加载数据...</div>
	</div>
</div>
<script type="text/javascript">
$(function(){
	$("#searchsubmit").click(function(){
		
		var key = $("input[name='searkey']").val();
		$.post("{:U('Index/getcxinfo')}", {key:key,random:Math.random()}, function(data){
		   if(data!=0){
			   $(".jiumalist").html(data);
		   }else{
			   $(".jiumalist").html("<span>没有数据!</span>");
		   }
		})

	})	
	
	    $("a.getcxaddres").click(function(){
			var vlue = $(this).attr("v");
			$(".jiumabg").fadeIn();
			$(".jiumabg .jiuma").show();
			$("input[name='ycid']").val(vlue);
			
			$.get("{:U('Index/getcxinfo')}", function(data){
			   if(data!=0){
				   $(".jiumalist").html(data);
			   }else{
				   $(".jiumalist").html("<span>没有数据返回!</span>");
			   }
			})
		})
		
		$("a.getcxaddres1").click(function(){
			$("input[name='jumpaddres']").val("http://act.hrtv.cn/consumer?bottomType=5&ut_source_domain=#domainid#");
		})
		
	$(".jiumaclose").click(function(){
		$(".jiumalist").html(null);
		$(".jiumabg .jiuma").hide();
		$(".jiumabg").fadeOut();
	})
	
})
</script>
<!-- **************************************************************************** -->
<div class="main-frame">
	<div class="position">华人码 > 编辑菜单信息</div>
	<!-- 图片资源开始 -->
	<div class="floatBackground" id="floatBackground" style="display: none;">
		<div class="bounced">
		<label class="closeImgResurces">X</label>
		<iframe id="imgResourcesiframe" src="{:rtrim(U('Upload/index'),'.html')}" width="750" height="465" frameborder="0" scrolling="auto"></iframe>
		</div>
	</div>
	<!-- 图片资源结束 -->
	<div class="addobject">
		<div class="obj-form">
			<form name="form1" id="form1" action="{:U('Type/menuedit',array('id'=>$result['id'],'rootid'=>I('get.rootid')))}" method="post" class="form-inline">
				<ul>
					<li>
						<label class="fl tle">菜单标题：</label>
						<span class="fl cnt"><input name="mtitle" class="form-control" placeholder="菜单标题" value="{$result.mtitle}"><em>*</em></span>
					</li>
					<li>
						<label class="fl tle">别名：</label>
						<span class="fl cnt"><input name="malias" class="form-control" placeholder="别名" value="{$result.malias}"><em>* <font>可用在首页上显示的标题</font></em></span>
					</li>
					<li>
						<label class="fl tle">其他信息：</label>
						<span class="fl cnt"><input name="update" class="form-control" placeholder="比如更新至2016-8-15" value="{$result.update}"><em><font>比如更新至2016-8-15</font></em></span>
					</li>
					<if condition="($Think.session.userinfo.id eq 28) and ($result.position eq 4 or $result.position eq 3)">
					<else />
						<li>
							<label class="fl tle">资源类型：</label>
					    	<span class="fl cnt">
						    	<select name="mtype" class="template form-control" style="width: 100px;">{:W('Menutype/showtype')}</select>
						    	<em>*</em>
					    	</span>
						</li>
						<li>
							<label class="fl tle">资源分类：</label>
					    	<span class="fl cnt">
						    	<select name="classtype" class="template form-control" style="width: 100px;">{:W('Menutype/classtype')}</select>
					    	</span>
						</li>
						<li>
							<label class="fl tle">显示位置：</label>
							<span class="fl cnt">
								<input type="checkbox" value="1" name="position[]" class="extendedattr"> 置顶
								<input type="checkbox" value="2" name="position[]" class="extendedattr"> 置底
								<input type="checkbox" value="3" name="position[]" class="extendedattr"> 置左
								<input type="checkbox" value="4" name="position[]" class="extendedattr"> 置右
							</span>
						</li>
						<li>
							<label class="fl tle">缩略图：</label>
							<span class="fl cnt"><input name="thumbimg" id="thumbimg" class="form-control" value="{$result['thumbimg']}" placeholder="缩略图"><a class="browse" f='thumbimg'>浏览···</a></span>
						</li>
						<if condition="$result['thumbimg'] neq ''">
							<li style="margin-top:-15px;">
								<label class="fl tle">&nbsp;</label>
								<span class="fl cnt"><img src="{$result['thumbimg']}" height="60" /></span>
							</li>
						</if>
						<li>
							<label class="fl tle">跳转网址：</label>
							<span class="fl cnt"><input name="jumpaddres" class="form-control" placeholder="如：http://www.hrtv.cn" value="{$result.jumpaddres}"> <a class="getcxaddres" style="margin-left:6px;">点击获取诚信节目地址</a> <a class="getcxaddres1" style="margin-left:6px;">没有嘉宾直接是诚信页面就点这个</a></span>
						</li>
						<if condition="$Think.session.userinfo.id neq 28">
						<li>
							<label class="fl tle">排序：</label>
							<span class="fl cnt"><input name="msort" class="txtlength200" value="{$result.msort}" style="width: 100px;" placeholder="0"></span>
						</li>
						</if>
						<li>
							<label class="fl tle">状态：</label>
							<span class="fl cnt">
								<input class="radio" type="radio" name="state" value="1" <if condition="$result.state eq 1">checked="checked"</if>> 开启
								&nbsp;&nbsp;&nbsp;&nbsp;<input class="radio" type="radio" name="state" value="0" <if condition="$result.state eq 0">checked="checked"</if>> 关闭
							</span>
						</li>
						<li>
							<label class="fl tle">父级菜单：</label>
					    	<span class="fl cnt">
						    	<select name="mparent" class="template form-control"><option value='0'>/</option>{$pmenu}</select>
						    	<em>*</em>
					    	</span>
						</li>
					</if>
					<li class="error" style="display:none;">
						<label class="fl tle">&nbsp;</label>
						<span class="fl cnt"><font>错误：此处显示错误提示</font></span>
					</li>
					<li class="submit">
						<label class="fl tle">&nbsp;</label>
						<span class="fl cnt"><input type="submit" value="确定修改" class="submitbtn" /> <a onclick="javascript:history.go(-1);" style="cursor:pointer;">返回</a></span>
					</li>
				</ul>
			</form>
		</div>
		<div class="obj-previewimg">
			<div class="rotation">
				<div class="thumbpreview"><img src="__IMG__/fenleitpl/1.jpg" /></div>
				<div class="thumbpreview"><img src="__IMG__/fenleitpl/2.jpg"/></div>
				<div class="thumbpreview"><img src="__IMG__/fenleitpl/3.jpg" /></div>
				<div class="thumbpreview"><img src="__IMG__/fenleitpl/4.jpg" /></div>
				<div class="thumbpreview"><img src="__IMG__/fenleitpl/5.jpg" /></div>
				<div class="thumbpreview"><img src="/Public/images/test7.jpg" /></div>
			</div>
			
			<div class="instructions">
				<b>特别说明：</b><br>
				菜单为无限级结构，根据需要在创建菜单的时候选择相应的父级菜单，如本身为一级菜单则按默认值保存。<br>
				<p class="advice">建议：菜单标题不易过长，以精、准为佳。</p>
			</div>
		</div>
	</div>

</div>
</body>
</html>
